<template>
  <div>
    <nav class="nav">
      <span class="back"></span>
      <span>充值</span>
    </nav>
    <div class="content">
      <h3>充值金额</h3>
      <ul class="list">
        <li
          v-for="(val, index) in list"
          :key="index"
          :class="{ monsel: monsel === index }"
          @click="moncli(index)"
        >
          {{ val }}
        </li>
      </ul>
      <h3>其他充值金额</h3>
      <div class="otherMoney">
        <input
          @input="putMon(putmon)"
          type="text"
          placeholder="0"
          v-model="putmon"
        />
      </div>
      <h3>支付方式</h3>
      <ul class="paytype">
        <li
          v-for="(item, index) in payType"
          :key="index"
          @click="n = index"
          :class="{ liSel: n === index }"
          v-show="index === 3 ? show : true"
        >
          <i></i>
          <span class="wz">{{ item }}</span>
          <b :class="['huisel', { sel: n === index }]"></b>
        </li>
      </ul>
      <p class="gd" @click="gd" v-show="!show">+点击查看更多</p>
    </div>
    <div class="foot">
      <p>
        <span>充值金额</span>
        <span class="red">￥ {{ money }}</span>
      </p>
      <button class="btn">充值</button>
    </div>
  </div>
</template>
<style lang="scss">
* {
  padding: 0;
  margin: 0;
}
ul {
  list-style: none;
}
.nav {
  width: 100%;
  height: 49px;
  line-height: 49px;
  text-align: center;
  position: relative;
  font-size: 20px;
  .back {
    width: 27px;
    height: 100%;
    display: inline-block;
    background: url('./1.png') center no-repeat;
    background-size: 35%;
    position: absolute;
    top: 0;
    left: 14px;
  }
}
.content {
  width: 100%;
  padding: 27px 16px;
  box-sizing: border-box;
  h3 {
    color: #000;
    font-size: 17px;
    font-weight: normal;
  }
}
.list {
  padding: 34px 0;
  display: flex;
  li {
    background: #e0e6e9;
    color: #333333;
    border-radius: 3px;
    width: 77px;
    height: 44px;
    margin: 0 5px;
    text-align: center;
    line-height: 44px;
  }
  .monsel {
    color: #fff;
    background: #008aff;
  }
}
.otherMoney {
  padding: 16px 0 34px 0;
  input {
    width: 140px;
    height: 44px;
    font-size: 30px;
    border: none;
    outline: none;
    padding-left: 20px;
    border-bottom: 0.03rem solid #f2f2f2;
  }
}
.paytype {
  padding-top: 34px;
  li {
    border: 2px solid #e0e0e0;
    padding: 0 23px;
    height: 54px;
    line-height: 54px;
    border-radius: 27px;
    margin-bottom: 19px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    i {
      width: 47px;
      height: 100%;
      display: inline-block;
      background-size: 50%;
    }
    .wz {
      position: absolute;
      left: 100px;
    }

    &:nth-child(1) i {
      background: url('./hvx.png') no-repeat center;
      background-size: 50%;
    }
    &:nth-child(2) i {
      background: url('./huizhi.png') no-repeat center;
      background-size: 50%;
    }
    &:nth-child(3) i {
      background: url('./hyin.png') no-repeat center;
      background-size: 50%;
    }
    &:nth-child(4) i {
      background: url('./huizhi.png') no-repeat center;
      background-size: 50%;
    }
    .huisel {
      width: 47px;
      height: 100%;
      background: url('./huisel.png') no-repeat center;
      display: inline-block;
      background-size: 50%;
    }
    .sel {
      background: url('./sel.png') no-repeat center;
      background-size: 50%;
    }
  }
  .liSel {
    color: #158ae3;
    border-color: #158ae3;
  }
  .liSel:nth-child(1) i {
    background: url('./vx.png') no-repeat center;
    background-size: 50%;
  }
  .liSel:nth-child(2) i {
    background: url('./zhi.png') no-repeat center;
    background-size: 50%;
  }
  .liSel:nth-child(3) i {
    background: url('./yin.png') no-repeat center;
    background-size: 50%;
  }
  .liSel:nth-child(4) i {
    background: url('./zhi.png') no-repeat center;
    background-size: 50%;
  }
}
.gd {
  font-size: 12px;
  text-align: center;
  color: grey;
}
.foot {
  width: 95%;
  height: 66px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  bottom: 0;
  left: 13px;
  .btn {
    color: #fff;
    background: #008aff;
    width: 88px;
    height: 37px;
    border-radius: 19px;
    border: none;
    font-size: 18px;
  }
  .red {
    color: red;
    font-size: 20px;
    font-weight: bold;
    margin-left: 10px;
  }
}
</style>
<script>
export default {
  data() {
    return {
      list: ['5元', '10元', '30元', '50元'],
      payType: ['微信支付', '支付宝支付', '银联支付', '花呗支付'],
      n: 0,
      money: 5,
      monsel: 0,
      putmon: '',
      show: false,
    }
  },
  methods: {
    moncli(ind) {
      this.monsel = ind
      this.money = this.list[ind]
    },
    putMon(x) {
      this.monsel = ''
      this.money = x
    },
    gd() {
      this.show = true
    },
  },
}
</script>
